<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:pe="http://primefaces.org/ui/extensions">
    <h:head>
        <title>Saldo Buku Besar</title>
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
    </h:head>
    <h:body>
        <ui:composition>
            <h:form>
                <!--
                <style type="text/css">
                    .ui-spinner {
                        width:50px;
                        background-color: white;
                    }
                </style>
                    -->            
                <p:toolbar>
                    <p:toolbarGroup align="left">
                        <p:commandButton value="#{bundle.btnLoad}" action="#{glbalanceBean.loadData()}"
                                         update="dtGLedgers" icon="ui-icon-arrowrefresh-1-w"  /> 
                        <p:commandButton type="push" action="#{rptGlbalanceBean.execute(glbalanceBean.glbalances)}" value="#{bundle.btnPrint}"  
                                         ajax="false" image="ui-icon-print" >
                            <f:setPropertyActionListener value="#{glbalanceBean.styleId}" target="#{rptGlbalanceBean.reportId}" />
                            <f:setPropertyActionListener value="#{glbalanceBean.startDate}" target="#{rptGlbalanceBean.startDate}" />
                            <f:setPropertyActionListener value="#{glbalanceBean.endDate}" target="#{rptGlbalanceBean.endDate}" />
                            <f:setPropertyActionListener value="#{glbalanceBean.branchId}" target="#{rptGlbalanceBean.branchId}" />
                            <f:setPropertyActionListener value="#{glbalanceBean.year}" target="#{rptGlbalanceBean.year}" />
                        </p:commandButton>
                    </p:toolbarGroup>
                </p:toolbar>
                
                <h:panelGrid id="displayGLedger" cellspacing="0" cellpadding="0" border="0" rowClasses="panelGridId" columnClasses="panelGridId, panelGridId"> 
                    <p:panel header="Filter Data" >
                        <h:panelGrid columns="2" cellspacing="0" cellpadding="0" border="0" rowClasses="panelGridId" columnClasses="panelGridId, panelGridId">
                        <p:outputPanel>
                            <h:panelGrid columns="3" border="0" cellpadding="0" cellspacing="3">
                                <h:outputLabel value= "Style" /><h:outputLabel value= ":" />
                                <p:selectOneMenu value="#{glbalanceBean.styleId}" style="width: 255px;">
                                    <f:selectItems value="#{glbalanceBean.avblStyle}" />
                                    <p:ajax update="dtGLedgers, glbalancePeriod, glbStartDate, glbEndDate" process="@this"/>
                                </p:selectOneMenu>

                                <h:outputLabel value= "#{bundle.branch}" /><h:outputLabel value= ":" />
                                <p:selectOneMenu value="#{glbalanceBean.branchId}" style="width: 255px;" >
                                    <f:selectItem itemLabel="Semua Cabang" itemValue="0"/>
                                    <f:selectItems value="#{glbalanceBean.avblBranch}"/>
                                </p:selectOneMenu>
                            </h:panelGrid>
                        </p:outputPanel>
                        
                        <p:outputPanel>
                            <h:panelGrid columns="4" border="0" cellpadding="0" cellspacing="3">
                                <h:outputLabel value= "Period" /><h:outputLabel value= ":" />
                                    <p:spinner value="#{glbalanceBean.year}" min="1945" max="3000" >
                                        <p:ajax listener="#{glbalanceBean.changeDate}"  />  
                                    </p:spinner>
                                    <p:selectOneMenu value="#{glbalanceBean.period}" style="width: 130px;" disabled="#{glbalanceBean.styleId==2}" id="glbalancePeriod">
                                        <f:selectItems value="#{glbalanceBean.avblPeriod}"/>
                                        <p:ajax listener="#{glbalanceBean.changeDate}" update="glbStartDate glbEndDate" process="@this"/>  
                                    </p:selectOneMenu>

                                <h:outputLabel value= "#{bundle.date}" /><h:outputLabel value= ":" />
                                    <p:calendar id="glbStartDate" value="#{glbalanceBean.startDate}" pattern="dd/MM/yyy" showOn="button"  size="18"
                                            maxdate="#{glbalanceBean.maxDate}" mindate="#{glbalanceBean.minDate}" disabled="#{glbalanceBean.styleId==2}"/>
                                    <p:outputPanel>
                                        <h:outputLabel value= "s.d"/> <p:spacer width="3"/>
                                        <p:calendar id="glbEndDate" value="#{glbalanceBean.endDate}" pattern="dd/MM/yyy" showOn="button" size="10"
                                            maxdate="#{glbalanceBean.maxDate}" mindate="#{glbalanceBean.minDate}" disabled="#{glbalanceBean.styleId==2}"/>
                                    </p:outputPanel>
                            </h:panelGrid>
                        </p:outputPanel>
                        </h:panelGrid>     
                    </p:panel>
                    
                    <p:panel header="#{bundle.glaccnt}" >
                        <h:panelGrid columns="3" border="0" cellpadding="0" cellspacing="5">
                            <p:dataTable id="dtGLedgers" value="#{glbalanceBean.glbalances}" var="gl" rowIndexVar="noUrut"
                                         scrollable="true" scrollWidth="960" resizableColumns="true" scrollHeight="280" >
                                
                                <p:column width="12">
                                    <f:facet name="header">No.</f:facet>
                                    <h:outputText value="#{noUrut+1}" />
                                </p:column>
                               
                                <p:column width="80" >
                                    <f:facet name="header">#{bundle.accountNo}</f:facet>
                                    <h:outputText value="#{gl.accountNo}" />
                                </p:column>
                                
                                <p:column width="300" >
                                    <f:facet name="header">#{bundle.accountName}</f:facet>
                                    <h:outputText value="#{gl.accountName}" />
                                </p:column>
                                
                                 <p:column width="100" >
                                     <f:facet name="header">#{bundle.accountType}</f:facet>
                                     <h:outputText value="#{gl.accountType}" />
                                </p:column>

                                <p:column width="100" >
                                    <f:facet name="header">#{bundle.saldoAwal}</f:facet>
                                    <h:outputText value="#{gl.awal}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                
                                <p:column width="100" rendered="#{glbalanceBean.styleId==1}" >
                                    <f:facet name="header">#{bundle.amount}</f:facet>
                                    <h:outputText value="#{gl.total}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(1)}</f:facet>
                                    <h:outputText value="#{gl.total01}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(2)}</f:facet>
                                    <h:outputText value="#{gl.total02}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(3)}</f:facet>
                                    <h:outputText value="#{gl.total03}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(4)}</f:facet>
                                    <h:outputText value="#{gl.total04}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(5)}</f:facet>
                                    <h:outputText value="#{gl.total05}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(6)}</f:facet>
                                    <h:outputText value="#{gl.total06}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(7)}</f:facet>
                                    <h:outputText value="#{gl.total07}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(8)}</f:facet>
                                    <h:outputText value="#{gl.total08}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(9)}</f:facet>
                                    <h:outputText value="#{gl.total09}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(10)}</f:facet>
                                    <h:outputText value="#{gl.total10}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(11)}</f:facet>
                                    <h:outputText value="#{gl.total11}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                <p:column width="100" rendered="#{glbalanceBean.styleId==2}" >
                                    <f:facet name="header">#{glbalanceBean.selectItemValueOf(12)}</f:facet>
                                    <h:outputText value="#{gl.total12}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                
                                <p:column width="100" >
                                    <f:facet name="header">#{bundle.balance}</f:facet>
                                    <h:outputText value="#{gl.saldo}" styleClass="numPos">
                                        <f:convertNumber groupingUsed="true" />
                                    </h:outputText>
                                </p:column>
                                
                            </p:dataTable>
                                
                        </h:panelGrid>
                    </p:panel>
                    
                </h:panelGrid>
            </h:form>
        </ui:composition>
    </h:body>
</html>